import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import {UploadTypeEnum} from "@/components/Form/src/jeecg/components/JUpload";
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '存货编号',
    align:"center",
    sorter: true,
    dataIndex: 'stockNum'
   },
   {
    title: '物资名称',
    align:"center",
    sorter: true,
    dataIndex: 'materialName'
   },
   {
    title: '规格',
    align:"center",
    dataIndex: 'specs'
   },
   {
    title: '交货最快周期',
    align:"center",
    dataIndex: 'cycleMin'
   },
   {
    title: '交货最慢周期',
    align:"center",
    dataIndex: 'cycleMax'
   },
   {
    title: '物资图片',
    align:"center",
    dataIndex: 'materialImg',
     customRender: render.renderImage,
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '数据状态',
    align:"center",
    dataIndex: 'status'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "存货编号",
    field: "stockNum",
    component: 'JInput',
  },
  {
    label: "物资名称",
    field: "materialName",
    component: 'JInput',
  },
  {
    label: "规格",
    field: "specs",
    component: 'JInput',
  },
     {
      label: "交货最快周期",
      field: "cycleMin",
      component: 'JRangeNumber',
      //colProps: {span: 6},
	},
	{
      label: "数据状态",
      field: 'status',
    component: 'RadioGroup',
    componentProps: {
      //options里面由一个一个的radio组成,支持disabled
      options: [
        { label: '已废弃', value: '已废弃' },
        { label: '使用中', value: '使用中' },
      ],
    },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '存货编号',
    field: 'stockNum',
    component: 'Input',
  },
  {
    label: '物资名称',
    field: 'materialName',
    component: 'Input',
  },
  {
    label: '规格',
    field: 'specs',
    component: 'Input',
  },
  {
    label: '交货最快周期',
    field: 'cycleMin',
    component: 'InputNumber',
  },
  {
    label: '交货最慢周期',
    field: 'cycleMax',
    component: 'InputNumber',
  },
  {
    label: '物资图片',
    field: 'materialImg',
    component: 'Input',

  },

  {
    field: 'materialImg',
    component: 'JUpload',
    label: '物资图片',
    helpMessage: '物资图片上传',
    componentProps: {
      fileType: UploadTypeEnum.image,

    },
  },


  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '数据状态',
    field: 'status',
    component: 'RadioGroup',
    componentProps: {
      //options里面由一个一个的radio组成,支持disabled
      options: [
        { label: '已废弃', value: '已废弃' },
        { label: '使用中', value: '使用中' },
      ],
    },
    colProps: { span: 4 },
  },




	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  stockNum: {title: '存货编号',order: 0,view: 'text', type: 'string',},
  materialName: {title: '物资名称',order: 1,view: 'text', type: 'string',},
  specs: {title: '规格',order: 2,view: 'text', type: 'string',},
  cycleMin: {title: '交货周期min',order: 3,view: 'number', type: 'number',},
  cycleMax: {title: '交货周期max',order: 4,view: 'number', type: 'number',},
  materialImg: {title: '物资图片',order: 5,view: 'text', type: 'string',},
  remark: {title: '备注',order: 6,view: 'text', type: 'string',},
  status: {title: '数据状态',order: 7,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
